package my.diplom.dao.impl;

import my.diplom.dao.IHostCardDAO;
import my.diplom.entity.HostCard;
import my.diplom.entity.Host;
import org.springframework.orm.hibernate3.HibernateTemplate;

/**
 * Created by IntelliJ IDEA.
 * User: gb
 * Date: 21.12.2009
 * Time: 0:26:25
 * To change this template use File | Settings | File Templates.
 */
public class HostCardDAOImpl implements IHostCardDAO {

     private HibernateTemplate template;

    public HibernateTemplate getTemplate() {
        return template;
    }

    public void setTemplate(HibernateTemplate template) {
        this.template = template;
    }

    @Override
    public void create(HostCard hostCard) {
        template.save(hostCard);
    }

    @Override
    public void update(HostCard hostCard) {
        template.saveOrUpdate(hostCard);
    }

    @Override
    public HostCard getById(Long hostCardId) {
       return (HostCard)template.get(HostCard.class, hostCardId);
    }
}
